if(!BXRL){var BXRL={};BXMobileApp.addCustomEvent("onPull-main",(function(t){if(t.command=="rating_vote"){RatingLike.LiveUpdate(t.params)}}))}RatingLike=function(t,e,i,n){this.enabled=true;this.entityTypeId=e;this.entityId=i;this.available=n=="Y";this.box=BX("bx-ilike-box-"+t);if(this.box===null){this.enabled=false;return false}const o=this.box.getAttribute("data-vote-key-signed");this.keySigned=o?o:"";this.button=BX("bx-ilike-button-"+t);if(!this.button){this.button=BX("rating_button")}this.count=BX.findChild(this.button,{tagName:"div",className:"post-item-inform-right"},true,false);this.countText=BX.findChild(this.box,{tagName:"span",className:"post-item-inform-right-text"},true,false);this.buttonCountText=BX.findChild(this.button,{tagName:"span",className:"post-item-inform-right-text"},true,false);this.likeTimeout=false;this.lastVote=BX.hasClass(this.button,"post-item-inform-likes-active")?"plus":"cancel"};RatingLike.Set=function(t,e,i,n){BXRL[t]=new RatingLike(t,e,i,n);if(BXRL[t].enabled){RatingLike.Init(t)}};RatingLike.Init=function(t){if(BXRL[t].available){BX.unbindAll(BXRL[t].button);BX.bind(BXRL[t].button,"click",(function(e){app.exec("callVibration");clearTimeout(BXRL[t].likeTimeout);var i=null;var n=null;if(BX.hasClass(BXRL[t].button,"post-item-inform-likes-active")){i=parseInt(BXRL[t].countText.innerHTML)-1;n="cancel";BXRL[t].countText.innerHTML=i;if(BXRL[t].buttonCountText){BXRL[t].buttonCountText.innerHTML=i}BX.removeClass(BXRL[t].button,"post-item-inform-likes-active");BXRL[t].likeTimeout=setTimeout((function(){if(BXRL[t].lastVote!="cancel"){RatingLike.Vote(t,"cancel")}}),1e3)}else{i=parseInt(BXRL[t].countText.innerHTML)+1;n="plus";BXRL[t].countText.innerHTML=i;if(BXRL[t].buttonCountText){BXRL[t].buttonCountText.innerHTML=i}BX.addClass(BXRL[t].button,"post-item-inform-likes-active");var o=BX.clone(BXRL[t].button);BX.adjust(BXRL[t].button.parentNode,{style:{position:"relative"}});BX.adjust(o,{style:{position:"absolute"}});BX.adjust(BXRL[t].button,{style:{visibility:"hidden"}});BX.prepend(o,BXRL[t].button.parentNode);new BX.easing({duration:120,start:{top:0,scale:100},finish:{top:-2,scale:130},transition:BX.easing.transitions.quad,step:function(t){o.style.transform="scale("+t.scale/100+")";o.style.top=t.top+"px"},complete:function(){new BX.easing({duration:120,start:{top:-2,scale:130},finish:{top:0,scale:100},transition:BX.easing.transitions.quad,step:function(t){o.style.transform="scale("+t.scale/100+")";o.style.top=t.top+"px"},complete:function(){o.parentNode.removeChild(o);BX.adjust(BXRL[t].button,{style:{visibility:"visible"}});BX.adjust(BXRL[t].button.parentNode,{style:{position:"static"}})}}).animate()}}).animate();BXRL[t].likeTimeout=setTimeout((function(){if(BXRL[t].lastVote!="plus"){RatingLike.Vote(t,"plus")}}),1e3)}var a=BX("rating-footer");if(!a&&typeof BXRL[t].button.parentNode.id!="undefined"){var s=BXRL[t].button.parentNode.id.match(/^rating_button_([\d]+)$/i);if(s!=null){a=BX("rating-footer_"+s[1])}}if(a){var l=BX.findChild(a,{className:"rating-footer-you"},true,false);var u=BX.findChild(a,{className:"rating-footer-youothers"},true,false);var r=BX.findChild(a,{className:"rating-footer-others"},true,false);oMSL.recalcRatingFooter({obYouNode:l,obYouAndOthersNode:u,obOthersNode:r,bSelf:true,voteAction:n,val:i})}BX.PreventDefault(e)}))}};RatingLike.Vote=function(t,e){var i=new MobileAjaxWrapper;i.Wrap({type:"json",method:"POST",url:BX.message("SITE_DIR")+"mobile/ajax.php?mobile_action=like",data:{RATING_VOTE:"Y",RATING_VOTE_TYPE_ID:BXRL[t].entityTypeId,RATING_VOTE_KEY_SIGNED:BXRL[t].keySigned,RATING_VOTE_ENTITY_ID:BXRL[t].entityId,RATING_VOTE_ACTION:e,sessid:BX.bitrix_sessid()},callback:function(i){if(typeof i!="undefined"&&typeof i.action!="undefined"&&typeof i.items_all!="undefined"){BXRL[t].lastVote=i.action;BXRL[t].countText.innerHTML=i.items_all;if(BXRL[t].buttonCountText){BXRL[t].buttonCountText.innerHTML=i.items_all}var n=BXRL[t].box.parentNode;var o=n.getAttribute("data-counter");if(o===null){n=BX("rating_button_cont");if(n){o=n.getAttribute("data-counter")}}if(o!==null){o=parseInt(o);n.setAttribute("data-counter",e=="plus"?o+1:o-1)}if(typeof oMSL!="undefined"&&typeof oMSL.logId!="undefined"&&oMSL.logId){BXMobileApp.onCustomEvent("onLogEntryRatingLike",{rating_id:t,voteAction:e,logId:oMSL.logId},true)}}else{var a=0;if(e=="plus"){a=parseInt(BXRL[t].countText.innerHTML)-1;BX.removeClass(BXRL[t].button,"post-item-inform-likes-active")}else{a=parseInt(BXRL[t].countText.innerHTML)+1;BX.addClass(BXRL[t].button,"post-item-inform-likes-active")}BXRL[t].countText.innerHTML=a;if(BXRL[t].buttonCountText){BXRL[t].buttonCountText.innerHTML=a}}},callback_failure:function(i){var n=0;if(e=="plus"){n=parseInt(BXRL[t].countText.innerHTML)-1;BX.removeClass(BXRL[t].button,"post-item-inform-likes-active")}else{n=parseInt(BXRL[t].countText.innerHTML)+1;BX.addClass(BXRL[t].button,"post-item-inform-likes-active")}BXRL[t].countText.innerHTML=n;if(BXRL[t].buttonCountText){BXRL[t].buttonCountText.innerHTML=n}}});return false};RatingLike.List=function(t){app.openTable({callback:function(){},url:(BX.message("MobileSiteDir")?BX.message("MobileSiteDir"):"/")+"mobile/index.php?mobile_action=get_likes&RATING_VOTE_TYPE_ID="+BXRL[t].entityTypeId+"&RATING_VOTE_ENTITY_ID="+BXRL[t].entityId+"&URL="+BX.message("RVPathToUserProfile"),markmode:false,showtitle:false,modal:false,cache:false,outsection:false,cancelname:BX.message("RVListBack")});return false};RatingLike.LiveUpdate=function(t){if(t.USER_ID==BX.message("USER_ID")){return false}for(var e in BXRL){if(BXRL[e].entityTypeId==t.ENTITY_TYPE_ID&&BXRL[e].entityId==t.ENTITY_ID){oMSL.onLogEntryRatingLike({ratingId:e,voteAction:t.TYPE=="ADD"?"plus":"cancel",logId:0,userId:t.USER_ID})}}};
//# sourceMappingURL=script_attached.map.js